<?php    
	@require '../ArqCnCli.php';
	$login = $_GET['login'];        
	$token =  $_GET['token'];
        $codempresa= $_GET['codempresa'];
        $online=$_GET['online'];
       
	$md5url = $_GET['md5'];        
    if (md5($login.$token.'liteciaugusto')==$md5url){		
	$tipo=$_GET['tipo'];
        $consulta = "SELECT * FROM tbempresa where codempresaliteci=".$codempresa; //CONSULTA
        $query1 = mysql_query($consulta);//EXECUTA A COSULTA
        $tbempresa=mysql_fetch_array($query1);
        $codrevenda=$tbempresa[18]; 
        $token = trim($tbempresa[14]);
        $emailempresa = trim($tbempresa[17]);
        $razaosocial =trim($tbempresa[1]);
        $apelidio= trim($tbempresa[3]);
        $fone= trim($tbempresa[12]);
        $endereco = trim($tbempresa[6].' - '.$tbempresa[7].' - '.$tbempresa[8].' - '.$tbempresa[9].' - '.$tbempresa[10].' - ').$tbempresa[11];
    
        $consulta = "SELECT * FROM tbrevenda where codrevendaliteci=".$codrevenda;
        $executa2  = mysql_query($consulta);
        $tbrevenda =  mysql_fetch_array($executa2);    
        $servicekey = $tbrevenda[3];
        $key = $tbrevenda[4];	
	
        $consulta = "SELECT * FROM user where login = '".$login."'";//CONSULTA
        
        $query = mysql_query($consulta);//EXECUTA A COSULTA
        $tbuser=mysql_fetch_array($query);//TRANSFORMA EM ARRAY A CONSULTA DISTRIBUINDO NOS LUGARES CORRETOS.	        
        $login = trim($tbuser[1]);//ATRIBUI UM VALOR A VARIAVEL        
        $id=trim($tbuser[0]);
        $nomeusuario  =  trim($tbuser[6]);		
	$emailusuario= trim($tbuser[5]);		
	$celular= trim($tbuser[8]);
        if ($emailempresa==$emailusuario){
            $emailempresa="";
        }
	if ($tipo=='cadcliente'){    
	?>
	    <form id="form2" target="" name="form2" method="post" action="http://liteci.mysuite1.com.br/cadcliente.php"> 
		<input type="hidden" name="fc_nomeempresa" id="fc_nomeempresa" value="<? echo $apelidio?>"/> 
		<input type="hidden" name="fc_cnpj" id="fc_cnpj" value=""/> 
		<input type="hidden" name="fc_endereco" id="fc_endereco" value="<?php $endereco?> "/> 
		<input type="hidden" name="fc_contato" id="fc_contato" value="<?php echo $nomeusuario ?>"/> 
		<input type="hidden" name="fc_obs" id="fc_obs" value=""/> 
		<input type="hidden" name="fc_razaosocial" id="fc_razaosocial" value="<? echo $razaosocial?>"/> 
		<input type="hidden" name="fc_inscest" id="fc_inscest" value=""/>
		<input type="hidden" name="fc_fone1" id="fc_fone1" value="<?php echo $fone?>"/> 
		<input type="hidden" name="fc_fone2" id="fc_fone2" value="<?php echo $celular?>"/> 		
		<input type="hidden" name="codigooriginal" id="codigooriginal" value="<?php echo $codempresa?>"/> 
		<input type="hidden" name="url" id="url" value="http://www.liteci.info/clientes/home.php"/> 
		<input type="hidden" name="servicekey" id="servicekey" value="<? echo md5($key.$codempresa.$servicekey);?>"/> 
		</form>
		<script language="JavaScript">
		form2.submit();                
		</script>		                
	<?php
	}
	    if ($tipo=='cadusuario'){
                if($online=='S'){
                  ?>  
                  <form id="form1" target="" name="form1" method="post" action="http://liteci.mysuite1.com.br/logininterno.php?param=hd_chat_gc_chatdep_noedit&inf=ID-Suporte:<?php echo $_GET['idsuporte']?>">;
                <?php 
                }else{
                 ?> <form id="form1" target="" name="form1" method="post" action="http://liteci.mysuite1.com.br/logininterno.php?param=hd_gc_noedit&inf=ID-Suporte:<?php echo $_GET['idsuporte']?>">;
                <?php               
                }                
		?>		
		<input type="hidden" name="fc_nomecompleto" id="fc_nomecompleto" value="<? echo $nomeusuario ?>"/> 
		<input type="hidden" name="fc_email1" id="fc_email1" value="<?php echo $emailusuario?>"/> 
		<input type="hidden" name="fc_email2" id="fc_email2" value="<?php echo $emailempresa?>"/> 
		<input type="hidden" name="fc_senha" id="fc_senha" value="<?php echo $codempresa ?>"/> 
		<input type="hidden" name="fc_obs" id="fc_obs" value=""/> 
		<input type="hidden" name="codigooriginal" id="codigooriginal" value="<?php echo $id?>"/> 
		<input type="hidden" name="it_codigooriginal" id="it_codigooriginal" value="<?php echo $codempresa?>"/> 
		<input type="hidden" name="servicekey" id="servicekey" value="<? echo md5($key.$id.$emailusuario.$servicekey);?>"/> 
		<input type="hidden" name="nologin" id="nologin" value=""/> 
		</form>
		<script language="JavaScript">		                    
                location.href="../home.php";    
                form1.submit();                   
		</script>			
		<?php
	}
	
	}else{
		echo "<script language='JavaScript'>location.href='http://wwww.liteci.info'</script>";
	}
			